package com.sgg.gulimall_product.controller;


import com.sgg.gulimall_common.api.Result;
import com.sgg.gulimall_product.api.validator.createGroup;
import com.sgg.gulimall_product.generator.domain.PmsBrand;
import com.sgg.gulimall_product.generator.service.PmsBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/PmsBrand")
public class PmsBrandController {


    @Autowired
    private PmsBrandService pmsBrandService;

    @PostMapping
    public Result createPmsBrand(@RequestBody @Validated(createGroup.class) PmsBrand pmsBrand) {

        final boolean save = pmsBrandService.save(pmsBrand);
        return save ? Result.success("success") : Result.failed();
    }

    @PutMapping
    public Result updatePmsBrand(@RequestBody @Validated PmsBrand pmsBrand) {
        final boolean save = pmsBrandService.updateById(pmsBrand);
        return save ? Result.success("success") : Result.failed();
    }


}
